package com.ruoyi.system.domain.vo;

import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.pv.domain.PvStudentRecord;
import com.ruoyi.pv.domain.PvTrainingClass;
import lombok.*;

import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 学员信息对象 sys_student
 * excel操作表
 * @author zzx
 * @date 2023-04-20
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
@Builder
@ToString
public class StudentExcelVo{

    /** 邮箱 */
    private Long userId;
    /** 邮箱 */
    private String email;
    /** 身份证 */
    private String identity;
    /** 性别 */
    private String sex;
    /** 密码 */
    private String password;


    /** 头像 */
    private String avatar;

    /**
     * 社区
     */
    @Excel(name = "社区")
    private String community;

    /**
     * 用户昵称
     */
    @Excel(name = "用户名",prompt = "登录使用，默认为上岗证")
    private String userName;

    /**
     * 预留字段1
     */
//    @Excel(name = "初复训" ,readConverterExp = "0=初训,1=复训")
    private Integer reservedOne;

    /**
     * 用户昵称
     */
    @Excel(name = "姓名(必填)")
    private String nickName;

    /**
     * 生日
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "出生年月", width = 30, dateFormat = "yyyy-MM-dd")
    private LocalDate birthday;

    /**
     * 执业范围
     */
    @Excel(name = "执业范围")
    private String practiceRange;

    /**
     * 执业类别
     */
    @Excel(name = "执业类别")
    private String practiceType;

    /**
     * 所在科室/岗位
     */
    @Excel(name = "所在科室/岗位")
    private String posts;


    /**
     * 手机号码
     */
    @Excel(name = "联系方式")
    private String phonenumber;

    /**
     * 参加初训年份
     */
    @Excel(name = "第一次培训年份")
    private String initialTraining;

    @Excel(name = "上岗证编号")
    private String postsNumber;


    //========================

    /**
     * 工作单位
     */
    @Excel(name = "工作单位")
    private String workUnit;

    /**
     * 备注
     */
    @Excel(name = "备注")
    private String docNumber;

//    /**
//     * 证件号
//     */
//    @Excel(name = "证件号")
//    private String comment;


    public static String popUpMassage(String strFormat,Object...messages){
        return "<br/>" + StrUtil.format(strFormat, messages);
    }

    // 或者在StudentExcelVo类中添加类型安全的setter方法
    public void setBirthday(Object birthday) {
        if (birthday == null) {
            this.birthday = null;
        } else if (birthday instanceof LocalDate) {
            this.birthday = (LocalDate) birthday;
        } else if (birthday instanceof String) {
            this.birthday = LocalDate.parse((String) birthday);
        } else {
            throw new IllegalArgumentException("Unsupported birthday type: " + birthday.getClass());
        }
    }

}
